package com.shu.qq.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.shu.qq.data.entity.User;
import com.shu.qq.mapper.UserMapper;
import com.shu.qq.service.UserService;

import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements UserService {

    @Override
    public boolean accountIsExists(String account){
        QueryWrapper<User> objectQueryWrapper = new QueryWrapper<>();
        objectQueryWrapper.eq("account",account);
        int count = count(objectQueryWrapper);
        return count > 0;
    }

    @Override
    public List<User> searchUsers(String like) {
        return null;
    }

    @Override
    public User searchUserFromAccount(String account) {
        QueryWrapper<User> objectQueryWrapper = new QueryWrapper<>();
        objectQueryWrapper.eq("account",account);
        return getOne(objectQueryWrapper);
    }

    @Override
    public boolean requestAddFriend(String account) {
        return false;
    }


}
